#!/bin/bash

function select_test()
{
    export PS3='please input[1 - 7]: '
    select i in linux unix windows centos ubuntu mac quit
    do
        echo $i
        [ "$i" = "quit" ] && break
    done
}

ifelif()
{

    if [ $n -eq 10 ] || [ $n -eq 100 ]; then
        echo "10000000"
    elif [ $n -eq 20 -o $n -eq 200 ]; then
        echo "20000000"
    elif [ $n -eq 30 ]; then
        echo "30000000"
    elif [ $n -eq 40 ]; then
        echo "40000000"
    else
        echo "00000000"
    fi
}

function case_test()
{
    case $n in
        10|100)
            echo 100000
            ;;
        20|200)
            echo 200000
            ;;
        30)
            echo 300000
            ;;
        40)
            echo 400000
            ;;
        *)
            echo 000000
            ;;
    esac
}

function if_cmd_test()
{
    if ls aaa &> /dev/null
    then
        echo is aaa
    elif ls bbb &> /dev/null
    then
        echo is bbb
    elif ls ccc &> /dev/null
    then
        echo is ccc
    else
        echo not
    fi
}

function if_test()
{
    # if test -z $1; then
    if [ -z $1 ] ; then
        echo "KYO"
    else
        echo "NOT"
    fi

    [ -z $1 ] && echo KYO || echo NOT
}


kyo()
{
    test $n -eq 10 && return 0
    echo function: $1 $2 $3 $4
    echo $i
    i=198
}

n=$1
[ -z $n ] && n=10
i=100
# kyo 111 222 333 444
kyo $1 $2 $3 $4 && echo "kyo success!"
echo kyo return: $?
echo shell: $1 $2 $3 $4
echo $i
# select_test

ifelif
case_test
